﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;

namespace PdfLibrary
{
    public class PdfNumber : IPdfObject
    {
        public double value;

        public bool LoadFromReader(PdfReader reader, bool throwException)
        {
            if (!double.TryParse(reader.ReadWord(), NumberStyles.Any, CultureInfo.InvariantCulture, out this.value))
                if (throwException) throw new PdfParsingException(reader, "PdfNumber parsing error: value is not double!");
                else return false;

            return true;
        }
    }
}
